package com.samples.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Bora SAYINER
 * @since Jan 24, 2015 4:30:41 PM
 * @version 1.0
 */
@WebServlet(urlPatterns = { "/SimpleServlet.do" })
public class SimpleServlet extends HttpServlet {

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String userName = req.getParameter("userName");
		String message = "Hello," + userName + ". Welcome to my page.";
		try {
			Thread.sleep(1500);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		resp.getWriter().println(message);
	}

}
